//order->订单页面的vuex
import { reqGetTradeInfo } from "@/api";

//state
const state = {
  tradeInfo:[], //订单信息数据
}

//mutations
const mutations = {
  receive_trade_info(state,tradeInfo){
    state.tradeInfo = tradeInfo
  }
}

//actions
const actions = {
  //获取订单数据
  async getTrade({commit}){
    const result = await reqGetTradeInfo()
    if(result.code !== 200){
       return result.message || '获取订单交易页信息失败'
    }
    commit('receive_trade_info',result.data)
  }

}
//getters
const getters = {
  
}

export default{
  state,
  mutations,
  actions,
  getters
}